package reader.xml;

import java.io.Reader;
import java.util.HashMap;

import reader.ClassMap;
import reader.IReader;
import reader.components.IComponentRW;

import components.Form;

public class XMLReader implements IReader {

    private HashMap opened;

    public static final String FORM = "form";

    public static final String FORM_EXT = "xfrm";

    public static final String FORM_FULL_EXT = ".xfrm";

    public Form read(Reader reader) {
        Form form = new Form();
        XMLContext context = XMLContext.createReaderRoot(reader);
        opened = new HashMap();
        IComponentRW component = ClassMap.getInstance().getComponentRW("Form", opened);
        component.read(form, context);
        return form;
    }

}
